package com.youi.shop.controller;


import com.youi.shop.commons.result.RespEntity;
import com.youi.shop.pojo.vo.productcategory.ProductCategoryVO;
import com.youi.shop.service.ProductCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 商品类别表 前端控制器
 * </p>
 *
 * @author xxf
 * @since 2020-11-09
 */
@RestController
@RequestMapping("/productCategory")
@Api(tags = "商品类别业务接口")
public class ProductCategoryController {

    @Resource
    ProductCategoryService productCategoryService;

    /**
     * 查询所有商品类别
     * @return
     */
    @GetMapping("/categoryList")
    @ApiOperation("获取所有商品类别")
    public RespEntity<List> selectAll() {
        List<ProductCategoryVO> productCategoryVOList= productCategoryService.selectAll();

        return RespEntity.success(productCategoryVOList);
    }


    @GetMapping("/categoryPage/{page}/{size}")
    @ApiOperation("分页获取商品类别")
    public RespEntity<List<ProductCategoryVO>> selectByPage(@PathVariable int page, @PathVariable int size) {
        List<ProductCategoryVO> list = productCategoryService.selectByPage(page,size);
        return RespEntity.success(list);
    }


}
